use actix_web::{HttpResponse};
use crate::{
    common::{Response, Pool},
    apps::backend::models::UserAccount as Model,
};

pub struct UserAccounts;

impl UserAccounts {

    /// 获取数据首页
    pub async fn index(db: Pool) -> HttpResponse {
        match Model::list(&db).await {
            Ok(v) => {
                Response::encrypt_data(&v)
            },
            Err(message) => {
                //let msg = message.to_string();
                Response::error(&message.to_string())
            }
        }
    }
}
